package com.me.learnspring.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.me.learnspring.common.OrderState;
import com.sun.istack.Nullable;
import lombok.*;

import javax.persistence.*;
import java.util.List;

@Entity
@Data
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
@Builder
@Table(name = "orders")
public class Order extends BaseEntity {
	@ManyToMany
	@JoinTable(
		name = "order_drink",
		joinColumns = {@JoinColumn(name = "drink_order_id")},
		inverseJoinColumns = {@JoinColumn(name = "items_id")}
	)
	@OrderBy("createTime")
	private List<Drink> items;
	private String customer;
	@Column(nullable = false)
	private OrderState state;
	
}
